package org.prothlisberger.musicsearch.exporter;


	import java.io.BufferedWriter;
	import java.io.File;
	import java.io.OutputStream;
	import java.io.OutputStreamWriter;
	import java.util.Iterator;

	public class XMLExporter implements IMusicExporter {

		public XMLExporter() {

		}

		@Override
		public void export(Iterator<File> aFiles, OutputStream aOutputStream) {
			try (BufferedWriter vWriter = new BufferedWriter(new OutputStreamWriter(aOutputStream, "utf-8"))) {
				while (aFiles.hasNext()) {
					File vFile = aFiles.next();
					vWriter.write("<song>");
					vWriter.write(vFile.getName());
					vWriter.write("</song>\n");
				}
			} catch (Exception e) {
				throw new RuntimeException("erreur pendant l'export", e);
			}
		}
	}
